package com.faw.fengyue.rfid.activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.faw.fengyue.rfid.R;
import com.faw.fengyue.rfid.utils.log.LogUtil;

public class SlashActivity extends AppCompatActivity {

    private static final String TAG = "SlashActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_slash);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        Thread slashThread = new Thread() {
            @Override
            public void run() {
                try {
                    sleep(1000);//是程序休眠五秒
                    Intent it = new Intent(getApplicationContext(), MainActivity.class);// 启动MainActivity
                    startActivity(it);
                    finish();//关闭当前活动
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        };
        slashThread.start();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.d(SlashActivity.TAG , "slash界面的onDestroy执行");
        LogUtil.d("onDestroy: slash界面");
    }
}